package heven.holt.wan.android.binding

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import heven.holt.library.widget.rise.RiseNumberTextView
import heven.holt.wan.android.R

@BindingAdapter("android:coin_level")
fun coinLevelImage(imageView: ImageView, level: Int) {
    val resource = when (level) {
        1 -> R.mipmap.ic_crown_1
        2 -> R.mipmap.ic_crown_2
        3 -> R.mipmap.ic_crown_3
        else -> R.mipmap.ic_crown_1
    }
    imageView.setImageResource(resource)
}

@BindingAdapter("android:text_rise")
fun setRiseNumberText(riseNumberTextView: RiseNumberTextView, num: Int) {
    riseNumberTextView.setInteger(0, num)
    riseNumberTextView.start()
}